package com.mike.server.system.role;

import com.mike.server.system.role.exception.RoleCreateException;
import com.mike.server.system.role.support.IRoleManager;

public class RoleManager implements IRoleManager {
	
	private static RoleManager instance = new RoleManager();
	
	private RoleManager() {
		//Don't allow new it outside.
	}
	
	public static RoleManager getInstance() {
		return instance;
	}

	

	private void checkRoleName(String roleName) throws RoleCreateException {
		if(null == roleName || roleName.equals("")) {
			throw new RoleCreateException("角色名称不能为空字符串或者null");
		}
	}

	@Override
	public Role create(String roleName, int sex, int job)
			throws RoleCreateException {
		checkRoleName(roleName);
		return new Role(roleName, sex, job);
	}
		

}
